System Status Checker by Wooshy

The System Status Checker allows you to easily check the status of a number of services running on various different servers. It uses javascript to dynamically refresh the list of statuses so that the statuses are always up to date.

It also records the outcome of each status request and stores it in a text file (no need for databases!) so that you can display simple statistics.

Introduction

This script allows you to:

Setting up this script is a breeze. Servers and services are defined in a CSV configuration file, which makes it very simple to edit.

Title,IP or address,port
Wooshy,www.wooshy.com,80
Example,www.example.com,25

Installation

Installation is simple, configure the files locally, and then upload the contents of the 'code' directory to your server!

1. Edit conf/sites.php

sites.php is a CSV file, on each line is the title of the server, the IP address/domain of the server, and the port number. Each service entry is placed on a new line. An example sites.php file is below:

Wooshy,www.wooshy.com,80
Quakenet,uk.quakenet.org,6667
Example,www.example.com,25

2. Edit conf/config.php

You can either customise the settings and messages (detailed below) in config.php or use the defaults.

4. chmod conf/history.txt

If you intend on using the history features of this script then you must chmod conf/history.txt to 777.

4. Upload & Use!

You're done!

Customisation

conf/config.php

show_protocol_in_title
This displays the protocol name in the title, useful if you have multiple services running on the same server and want to make the differentiation easier. E.g. Google (Web Server) — default value: true

show_ip
This displays the IP address/domain name of the requested server below its title. — default value: true

timeout
The timeout of the connection request (in seconds). — default value: 5

page_title
The page title (<title>). — default value: System Status

heading
The heading displayed at the top of the page (<h1>). — default value: System Status

site_name
Used in the copyright notice in the footer. — default value: Your Site

show_history
Enables/disables the showing (and recording) the history of status requests. — default value: true

timestamp
The format in which the last recorded downtime is displayed — default value: F j, Y, g:i a

refresh_period
How often the AJAX refreshes the server status (in ms) — default value: 60000 (1 minute)

message_if_down
The message displayed if the server is down. — default value: Sorry, the %service% is currently unavailable. You will be unable to %do_something% while we work on this.

message_if_avail
The message displayed if the server is available. — default value: %service% is running and available! (Port %port%)

percentage_precision
The number of decimals places to display the uptime percentage in. — default value: 1

send_email
Whether or not to send emails when a service is found to be down. — default value: false

email_address
What email address to send the notice to.

email_limit
Limits how many emails can be sent. Default is to wait 600 seconds (10 minutes) before allowing another email to be sent, this prevents spam. — default value: 600

VariableContent
%server_ip%IP address of the server (e.g. 127.0.0.1)
%port%Port number of the service (e.g. 80)
%service%The name of the protocol (defined in protocols.php)
%do_something%What the users won't be able to do while this service is down (defined in protocols.php)
%error_number%Error number (e.g. 110) — only available in message_if_down
%error_message%Error message (e.g. Connection timed out) — only available in message_if_down

conf/protocols.php

This file defines the various protocol titles and usages based on port number.

Format is $port[portnumber][attribute].

Note: both 'title' and 'usage' NEED to be set.

Script Structure

index.php
remote.php

conf/config.php
conf/history.txt
conf/protocols.php
conf/sites.php

css/style.php

img/down.jpg
img/up.jpg

index.php

This is the application that is viewed from your browser. (E.g. http://www.example.com/status/status.php)

remote.php

This file is loaded by javascript and provides the content of the script

conf/config.php

In this file you can customise the messages displayed when a service is found to be up or down. You can change the timeout, whether IPs are displayed, and change the page title.

conf/history.txt

This file provides the history of status requests, if enabled, and is in a CSV format. The order of data is ip:port, date of first check, date last time the check found the service down, number of times the service has been seen down, and number of times the service has been seen available.

conf/protocols.php

This file defines the service names and what is provided for various ports.

conf/sites.php

The servers that you want to check the status of are defined in this file.

css/style.css

The document's stylesheet.

img/down.jpg & img/up.jpg

The images displayed depending on the server's status.

Authors

This program was developed by Wooshy, a UK based web design and development agency.